package com.mrx.compose.weather.api.qweather

import com.mrx.compose.weather.api.annotations.Api
import com.mrx.compose.weather.api.qweather.response.BaseResponse
import retrofit2.http.GET
import retrofit2.http.Query

@Api("https://geoapi.qweather.com")
interface GeoApi {

    @GET("/v2/city/lookup")
    suspend fun cityLookup(
        @Query("location") location: String,
        @Query("key") key: String = ApiConfig.key
    ): LocationResponse

    class LocationResponse : BaseResponse() {
        var location: List<Location>? = null
        override fun toString(): String {
            return "LocationResponse(location=$location)"
        }
    }

    data class Location(
        var name: String? = null,
        var id: String? = null,
        var lat: String? = null,
        var lon: String? = null,
        var adm2: String? = null,
        var adm1: String? = null,
        var country: String? = null,
        var tz: String? = null,
        var utcOff: String? = null,
        var isDst: String? = null,
        var type: String? = null,
        var rank: String? = null,
        var fxLink: String? = null
    )

}